3.37 \(\int \frac{\cos ^2(x)}{a+b \cos ^2(x)} \, dx\)

Optimal. Leaf size=38 \[ \frac{\sqrt{a} \tan ^{-1}\left (\frac{\sqrt{a+b} \cot (x)}{\sqrt{a}}\right )}{b \sqrt{a+b}}+\frac{x}{b} \]

[Out]

x/b + (Sqrt[a]*ArcTan[(Sqrt[a + b]*Cot[x])/Sqrt[a]])/(b*Sqrt[a + b])

________________________________________________________________________________________

Rubi [A]  time = 0.0596243, antiderivative size = 38, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {3171, 3181, 205} \[ \frac{\sqrt{a} \tan ^{-1}\left (\frac{\sqrt{a+b} \cot (x)}{\sqrt{a}}\right )}{b \sqrt{a+b}}+\frac{x}{b} \]

Antiderivative was successfully verified.

[In]

Int[Cos[x]^2/(a + b*Cos[x]^2),x]

[Out]

x/b + (Sqrt[a]*ArcTan[(Sqrt[a + b]*Cot[x])/Sqrt[a]])/(b*Sqrt[a + b])

Rule 3171

Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)]^2)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(B*x
)/b, x] + Dist[(A*b - a*B)/b, Int[1/(a + b*Sin[e + f*x]^2), x], x] /; FreeQ[{a, b, e, f, A, B}, x]

Rule 3181

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[1/(a + (a + b)*ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x]

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{\cos ^2(x)}{a+b \cos ^2(x)} \, dx &=\frac{x}{b}-\frac{a \int \frac{1}{a+b \cos ^2(x)} \, dx}{b}\\ &=\frac{x}{b}+\frac{a \operatorname{Subst}\left (\int \frac{1}{a+(a+b) x^2} \, dx,x,\cot (x)\right )}{b}\\ &=\frac{x}{b}+\frac{\sqrt{a} \tan ^{-1}\left (\frac{\sqrt{a+b} \cot (x)}{\sqrt{a}}\right )}{b \sqrt{a+b}}\\ \end{align*}

Mathematica [A]  time = 0.0786466, size = 36, normalized size = 0.95 \[ \frac{x-\frac{\sqrt{a} \tan ^{-1}\left (\frac{\sqrt{a} \tan (x)}{\sqrt{a+b}}\right )}{\sqrt{a+b}}}{b} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[x]^2/(a + b*Cos[x]^2),x]

[Out]

(x - (Sqrt[a]*ArcTan[(Sqrt[a]*Tan[x])/Sqrt[a + b]])/Sqrt[a + b])/b

________________________________________________________________________________________

Maple [A]  time = 0.017, size = 32, normalized size = 0.8 \begin{align*} -{\frac{a}{b}\arctan \left ({a\tan \left ( x \right ){\frac{1}{\sqrt{ \left ( a+b \right ) a}}}} \right ){\frac{1}{\sqrt{ \left ( a+b \right ) a}}}}+{\frac{x}{b}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(x)^2/(a+b*cos(x)^2),x)

[Out]

-1/b/((a+b)*a)^(1/2)*arctan(a*tan(x)/((a+b)*a)^(1/2))*a+x/b

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(a+b*cos(x)^2),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.83715, size = 447, normalized size = 11.76 \begin{align*} \left [\frac{\sqrt{-\frac{a}{a + b}} \log \left (\frac{{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \,{\left (4 \, a^{2} + 3 \, a b\right )} \cos \left (x\right )^{2} + 4 \,{\left ({\left (2 \, a^{2} + 3 \, a b + b^{2}\right )} \cos \left (x\right )^{3} -{\left (a^{2} + a b\right )} \cos \left (x\right )\right )} \sqrt{-\frac{a}{a + b}} \sin \left (x\right ) + a^{2}}{b^{2} \cos \left (x\right )^{4} + 2 \, a b \cos \left (x\right )^{2} + a^{2}}\right ) + 4 \, x}{4 \, b}, \frac{\sqrt{\frac{a}{a + b}} \arctan \left (\frac{{\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a\right )} \sqrt{\frac{a}{a + b}}}{2 \, a \cos \left (x\right ) \sin \left (x\right )}\right ) + 2 \, x}{2 \, b}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(a+b*cos(x)^2),x, algorithm="fricas")

[Out]

[1/4*(sqrt(-a/(a + b))*log(((8*a^2 + 8*a*b + b^2)*cos(x)^4 - 2*(4*a^2 + 3*a*b)*cos(x)^2 + 4*((2*a^2 + 3*a*b +
b^2)*cos(x)^3 - (a^2 + a*b)*cos(x))*sqrt(-a/(a + b))*sin(x) + a^2)/(b^2*cos(x)^4 + 2*a*b*cos(x)^2 + a^2)) + 4*
x)/b, 1/2*(sqrt(a/(a + b))*arctan(1/2*((2*a + b)*cos(x)^2 - a)*sqrt(a/(a + b))/(a*cos(x)*sin(x))) + 2*x)/b]

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)**2/(a+b*cos(x)**2),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.18379, size = 65, normalized size = 1.71 \begin{align*} -\frac{{\left (\pi \left \lfloor \frac{x}{\pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (a\right ) + \arctan \left (\frac{a \tan \left (x\right )}{\sqrt{a^{2} + a b}}\right )\right )} a}{\sqrt{a^{2} + a b} b} + \frac{x}{b} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(x)^2/(a+b*cos(x)^2),x, algorithm="giac")

[Out]

-(pi*floor(x/pi + 1/2)*sgn(a) + arctan(a*tan(x)/sqrt(a^2 + a*b)))*a/(sqrt(a^2 + a*b)*b) + x/b